package lanqiao;
/**
 * @Project : AlgorithmLearning
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q1458.java
 * @Author : WangRuoyu
 * @Date : 2023/3/30 10:50
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Q1458 {
    static int n;
    static int m;
    static int[] a;
    static int[] b = new int[100010];
    static int cnt = 0;

    static void change(int p, int l, int r) {
        int[] tmp = new int[l - p];
        for (int i = r - l + p + 1; i <= r; ++i) {
            tmp[i - r + l - p - 1] = a[i];
        }
        Arrays.sort(tmp);
        for (int i = r; i >= l; --i) {
            a[i] = a[i - l + p];
        }
        for (int i = p; i < l; ++i) {
            a[i] = tmp[l - i - 1];
        }
    }

    static void change0(int d) {
        int[] tmp = new int[d];
        for (int i = 0; i < tmp.length; ++i) {
            tmp[i] = a[i];
        }
        Arrays.sort(tmp);
        for (int i = 0; i < tmp.length; ++i) {
            a[i] = tmp[tmp.length - 1 - i];
        }
    }

    static void change1(int d) {
        int[] tmp = new int[d];
        for (int i = n - d; i < n; ++i) {
            tmp[i - n + d] = a[i];
        }
        Arrays.sort(tmp);
        for (int i = 0; i < tmp.length; ++i) {
            a[i + n - d] = tmp[i];
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");
        n = Integer.parseInt(words[0]);
        m = Integer.parseInt(words[1]);

        a = new int[n];
        for (int i = 0; i < a.length; ++i) {
            a[i] = i + 1;
        }

        for (int i = 0; i < m; ++i) {  // 读入操作
            words = br.readLine().split(" ");
            int p = Integer.parseInt(words[0]);
            int len = Integer.parseInt(words[1]);
            if (cnt == 0) {
                if (p != 1) {
                    b[cnt++] = len;
                }
            } else {
                int op = (cnt - 1) % 2;
                if (op == 0 && p == op) {
                    b[cnt - 1] = Math.max(b[cnt - 1], len);
                } else if (op == 1 && p == op) {
                    b[cnt - 1] = Math.min(b[cnt - 1], len);
                } else {
                    b[cnt++] = len;
                }
                while (cnt > 2 && b[cnt - 1] >= b[cnt - 3] && cnt % 2 == 1) { // 保留有效操作
                    b[cnt - 3] = b[cnt - 1];
                    cnt -= 2;
                }
                while (cnt > 2 && b[cnt - 1] <= b[cnt - 3] && cnt % 2 == 0) { // 保留有效操作
                    b[cnt - 3] = b[cnt - 1];
                    cnt -= 2;
                }
            }
        }

        int p = 0;
        int i = 0;

        for (i = 0; i < cnt / 2; ++i) {
            int r = b[2 * i] - 1;
            int l = b[2 * i + 1] - 1;
            if (r <= l) {
                break;
            }
            change(p, l, r);
            p = l;
        }

        if (2 * i == cnt) {
            for (int j : a) {
                System.out.print(j + " ");
            }

        } else if (i * 2 + 1 == cnt) {
            change0(b[cnt - 1]);
            for (int j : a) {
                System.out.print(j + " ");
            }
        } else if (i * 2 + 1 < cnt) {
            change0(b[2 * i]);
            change1(n - b[2 * i + 1]);
            for (int j : a) {
                System.out.print(j + " ");
            }
        }
    }
}
